// 获取标题元素
let li_list = document.querySelectorAll(".tilteList>li");

let box = document.querySelector(".box");
let main = document.querySelectorAll(".main");

let flag = false;

li_list.forEach(function (el, idx) {
  el.addEventListener("mouseenter", function () {
    // let h = getComputedStyle(main[lastIndex], "style").height;
    if (flag) {
      // 清除过渡动画
      main[idx].style.transition = "none";
    }
    // if (flag || h !== "0px") {
    //   main[idx].style.transition = "none";
    // };
    flag = true;
    main[idx].style.height = "180px";
  });

  el.addEventListener("mouseleave", function () {
    main[idx].style.height = "0px";
    main[idx].style.transition = "none";
    // li_list[i].style.height ="80px";
  });
});
box.addEventListener("mouseleave", function () {
  main.forEach(function (el) {
    el.style.transition = "1s ease";
    flag = false;
  });
});
